Section 1: Instances where a bout is identified by Phil’s code but not Weipeng’s

Per phil’s paper, he says: PA bouts were defined as time intervals having accelerometer counts > 500 counts per 30 s epoch (cpe) for at least 7 min, allowing for up to 2 min of epochs below that threshold during the 7 min interval. We have decided that we will consider something a bout as long as it is at least 5 minutes.

Long Bouts

ID 10100725: Part of the reason that we do not find the same bout is because at this time,weipeng has a bout in progress. This is because at 10:21a, the individual was active for until 10:53a, at which point they were low active then non active and we ended their bout. That said, I have no idea why Phil did not start this bout until 10:25a and I also do not understand why phil ends this bout at 10:46a because this person remains active until 10:52a. Some of the epochs between 10:46a and 10:52a are low active, but there are never more than 1 low active epochs in a row. If it were an issue of consecutive vs cumulative inactive time, that still does not explain it becuase phil ends this bout after 6 epochs of low activity, which violates what his paper says he does which is end a bout after 2 min, or 4 epochs, of non-active time. I cannot explain what is going on with phil’s code here, but I can verify that our code is correct.

id <- 10100725
phil_start_time <- ymd_hms("2008-07-21 10:25:00")
phil_end_time <- ymd_hms("2008-07-21 10:46:00")
w_start_time <- ymd_hms("2008-07-21 10:21:00")
w_end_time <- ymd_hms("2008-07-21 10:52:30")
phil_bout_duration <- 21.5

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

ID 14835176: I have absolutely no idea how phil started a bout at 8:57a, but we had started it at 8:46a because this participant was active without even any inactivity/low activity starting at 8:46a. We both end it at 9:07 a because starting then there is more than 4 epochs of low/inactivity. That said, there were already exactly 4 epochs of low activity in this bout, and at 9:07 the fifth one occurs. This makes me think that the logic is allow 4 epochs of inactivity/low activity, and end bouts on the 5th, which may explain some of the other weirdness with how he counts inactive epochs for other participants.

id <- 14835176
phil_start_time <- ymd_hms("2009-07-08 08:57:00")
phil_end_time <- ymd_hms("2009-07-08 09:07:00")
w_start_time <- ymd_hms("2009-07-08 08:46:00")
w_end_time <- ymd_hms("2009-07-08 09:07:00")
phil_bout_duration <- 10

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

kable(table %>% filter(!is.na(bout_label)))
epoch_time Axis1_epochSum Activity bout_label gps_inlier LATITUDE LONGITUDE Point_circle_area Point_radius incomplete_GPS
2009-07-08 08:46:30 922 Active 65 TRUE 47.37434 -122.0923 1904.846 80.78673 0
2009-07-08 08:47:00 624 Active 65 FALSE 47.37383 -122.0925 1904.846 80.78673 0
2009-07-08 08:47:30 643 Active 65 TRUE 47.37402 -122.0925 1904.846 80.78673 0
2009-07-08 08:48:00 3128 Active 65 NA NA NA 1904.846 80.78673 0
2009-07-08 08:48:30 2939 Active 65 TRUE 47.37417 -122.0927 1904.846 80.78673 0
2009-07-08 08:49:00 3023 Active 65 TRUE 47.37424 -122.0927 1904.846 80.78673 0
2009-07-08 08:49:30 2913 Active 65 TRUE 47.37427 -122.0927 1904.846 80.78673 0
2009-07-08 08:50:00 2778 Active 65 TRUE 47.37406 -122.0927 1904.846 80.78673 0
2009-07-08 08:50:30 2617 Active 65 NA NA NA 1904.846 80.78673 0
2009-07-08 08:51:00 2785 Active 65 TRUE 47.37411 -122.0928 1904.846 80.78673 0
2009-07-08 08:51:30 2892 Active 65 TRUE 47.37423 -122.0926 1904.846 80.78673 0
2009-07-08 08:52:00 2975 Active 65 TRUE 47.37427 -122.0927 1904.846 80.78673 0
2009-07-08 08:52:30 3003 Active 65 NA NA NA 1904.846 80.78673 0
2009-07-08 08:53:00 2947 Active 65 TRUE 47.37407 -122.0928 1904.846 80.78673 0
2009-07-08 08:53:30 2959 Active 65 TRUE 47.37417 -122.0927 1904.846 80.78673 0
2009-07-08 08:54:00 3064 Active 65 TRUE 47.37425 -122.0927 1904.846 80.78673 0
2009-07-08 08:54:30 3224 Active 65 TRUE 47.37422 -122.0927 1904.846 80.78673 0
2009-07-08 08:55:00 3154 Active 65 TRUE 47.37420 -122.0927 1904.846 80.78673 0
2009-07-08 08:55:30 3092 Active 65 NA NA NA 1904.846 80.78673 0
2009-07-08 08:56:00 3188 Active 65 NA NA NA 1904.846 80.78673 0
2009-07-08 08:56:30 3094 Active 65 TRUE 47.37410 -122.0926 1904.846 80.78673 0
2009-07-08 08:57:00 2979 Active 65 TRUE 47.37407 -122.0925 1904.846 80.78673 0
2009-07-08 08:57:30 2243 Active 65 TRUE 47.37422 -122.0926 1904.846 80.78673 0
2009-07-08 08:58:00 2376 Active 65 TRUE 47.37423 -122.0927 1904.846 80.78673 0
2009-07-08 08:58:30 1945 Active 65 TRUE 47.37410 -122.0926 1904.846 80.78673 0
2009-07-08 08:59:00 1015 Active 65 TRUE 47.37418 -122.0927 1904.846 80.78673 0
2009-07-08 08:59:30 774 Active 65 TRUE 47.37409 -122.0926 1904.846 80.78673 0
2009-07-08 09:00:00 305 Low active 65 TRUE 47.37414 -122.0926 1904.846 80.78673 0
2009-07-08 09:00:30 35 Low active 65 TRUE 47.37421 -122.0926 1904.846 80.78673 0
2009-07-08 09:01:00 530 Active 65 TRUE 47.37424 -122.0926 1904.846 80.78673 0
2009-07-08 09:01:30 13 Low active 65 TRUE 47.37412 -122.0927 1904.846 80.78673 0
2009-07-08 09:02:00 171 Low active 65 NA NA NA 1904.846 80.78673 0
2009-07-08 09:02:30 1878 Active 65 TRUE 47.37429 -122.0927 1904.846 80.78673 0
2009-07-08 09:03:00 1932 Active 65 TRUE 47.37413 -122.0926 1904.846 80.78673 0
2009-07-08 09:03:30 976 Active 65 NA NA NA 1904.846 80.78673 0
2009-07-08 09:04:00 817 Active 65 NA NA NA 1904.846 80.78673 0
2009-07-08 09:04:30 999 Active 65 NA NA NA 1904.846 80.78673 0
2009-07-08 09:05:00 1016 Active 65 TRUE 47.37412 -122.0926 1904.846 80.78673 0
2009-07-08 09:05:30 637 Active 65 TRUE 47.37401 -122.0924 1904.846 80.78673 0
2009-07-08 09:06:00 1068 Active 65 TRUE 47.37404 -122.0925 1904.846 80.78673 0
2009-07-08 09:06:30 774 Active 65 NA NA NA 1904.846 80.78673 0

ID 14830788: This was a bug in both our code and phil’s code. phil is counting a bout that has more inactivity than he says his code tolerates, but this was also a bug in our code. Per our defintion, we asserted that a bout must: Contains at least 10 cumulative 30-second epochs of activity. In our implementation, though, I was allowing a bout to contain more than 10 cumulative 30 second epochs, rather than >= 10. I have corrected this in our code.

id <- 14830788
phil_start_time <- ymd_hms("2009-07-02 11:07:00")
phil_end_time <- ymd_hms("2009-07-02 14:31:00")
w_start_time <- ymd_hms("2009-07-02 11:07:30")
w_end_time <- ymd_hms("2009-07-02 11:12:00")
phil_bout_duration <- 204

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

ID 13322435: We are counting this as a bout but we begin counting much earlier (at 15:45). I would guess phil did not do the same because between 15:45 and 15:57 there are more than 4 cumulative epochs of inactive/low active time. We count consecutively and we never reach 4 consecutive epochs in the time period. Of note, I am also wondering if phil considers it to be 4 cumulative epochs of inactivity per 14 cumulative epochs (7 min) of active time. Because in this period from 15:57 - 17:15, there are 10 epochs of inactive time and approximately 26 epochs of active time. The math isnt perfect but im just confused about his logic. this doesnt really matter since we arent using cumulative inactivity but just wondering

ID 10101700: We do not start a new bout at 9:01a because we are already in the middle of a bout that started at 7:58a. I would guess that Phil started a bout at the same time, and ended that bout after 4 non-consecutive but cumulative instances of low/inactivity at 8:58a. This explains why we may be in the middle of a bout and phil is not in the middle of a bout. What I don’t understand is how he then started a bout at 9:01a because from there, there are the following epochs: active / low active / active / low active / low active / active / low active / active 8:58:30a / 8:59:00a / 8:59:30 / 9:00:00a / 9:00:30a / 9:01:00a / 9:01:30a / 9:02:00a So, theoretically phil would have started counting a bout at 8:58a and then hit his limit of low/inactivity at 9:01:30a and then started the bout at 9:02:00a and gone from there. In any case, our code is functioning properly and according to our rules.

id <- 10101700
phil_start_time <- ymd_hms("2008-09-14 09:01:00")
phil_end_time <- ymd_hms("2008-09-14 09:39:00")
w_start_time <- ymd_hms("2008-09-14 07:58:00")
w_end_time <- ymd_hms("2008-09-14 09:24:30")
phil_bout_duration <- 38.5

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

Short Bouts

there are no bouts under 8 min that phil identifies and we do not also identify in the same way. so, ill check 5 more people

ID 11516771: Phil starts this bout at 21:13 when there is one active epoch, followed by 4 inactive epochs and then at 21:15:30 there is active time. We start our bout here, at 21:15:30 because we tried to start at 21:13, hit 4 inactive/low active epochs, and ended our bout attempt. we then started again at 21:15 and were able to get into a bout. This active time lasts until one low active epoch at 21:31:00 and then alternating active and low active time until 21:36:30 at which point non active time for more than 4 epochs starts at 21:36. phil ends at 21:34 becuase there is an epoch of low active time which must put him over his cumulative threshold. But, since 21:13, there are 8 epochs of low activity and this one that he ends on his the 9th, which supports my idea that it is 2 epochs of low/inactivity for a set amount of active time - not just cumulatively 4 epochs of inactivity. it also supports my theory that he ends on the 5th epoch of inactivity, not the 4th.

id <- 11516771
phil_start_time <- ymd_hms("2008-11-22 21:13:00")
phil_end_time <- ymd_hms("2008-11-22 21:34:00")
w_start_time <- ymd_hms("2008-11-22 21:15:30")
w_end_time <- ymd_hms("2008-11-22 21:36:00")
phil_bout_duration <- 21.5

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

kable(table %>% filter(!is.na(bout_label)))
epoch_time Axis1_epochSum Activity bout_label gps_inlier LATITUDE LONGITUDE Point_circle_area Point_radius incomplete_GPS
2008-11-22 21:15:30 1829 Active 13 FALSE 47.37147 -122.1945 198823.5 825.361 0
2008-11-22 21:16:00 1925 Active 13 FALSE 47.37168 -122.1945 198823.5 825.361 0
2008-11-22 21:16:30 1872 Active 13 TRUE 47.37183 -122.1942 198823.5 825.361 0
2008-11-22 21:17:00 1749 Active 13 TRUE 47.37187 -122.1939 198823.5 825.361 0
2008-11-22 21:17:30 1731 Active 13 TRUE 47.37192 -122.1936 198823.5 825.361 0
2008-11-22 21:18:00 1994 Active 13 TRUE 47.37192 -122.1933 198823.5 825.361 0
2008-11-22 21:18:30 616 Active 13 TRUE 47.37194 -122.1930 198823.5 825.361 0
2008-11-22 21:19:00 2128 Active 13 TRUE 47.37198 -122.1928 198823.5 825.361 0
2008-11-22 21:19:30 2208 Active 13 TRUE 47.37193 -122.1925 198823.5 825.361 0
2008-11-22 21:20:00 2238 Active 13 TRUE 47.37198 -122.1922 198823.5 825.361 0
2008-11-22 21:20:30 2236 Active 13 TRUE 47.37198 -122.1918 198823.5 825.361 0
2008-11-22 21:21:00 2145 Active 13 TRUE 47.37197 -122.1915 198823.5 825.361 0
2008-11-22 21:21:30 2190 Active 13 TRUE 47.37194 -122.1911 198823.5 825.361 0
2008-11-22 21:22:00 2323 Active 13 TRUE 47.37206 -122.1909 198823.5 825.361 0
2008-11-22 21:22:30 2214 Active 13 TRUE 47.37229 -122.1910 198823.5 825.361 0
2008-11-22 21:23:00 1784 Active 13 TRUE 47.37252 -122.1910 198823.5 825.361 0
2008-11-22 21:23:30 2010 Active 13 TRUE 47.37268 -122.1908 198823.5 825.361 0
2008-11-22 21:24:00 2133 Active 13 TRUE 47.37282 -122.1907 198823.5 825.361 0
2008-11-22 21:24:30 1352 Active 13 TRUE 47.37306 -122.1907 198823.5 825.361 0
2008-11-22 21:25:00 751 Active 13 TRUE 47.37321 -122.1907 198823.5 825.361 0
2008-11-22 21:25:30 959 Active 13 TRUE 47.37327 -122.1906 198823.5 825.361 0
2008-11-22 21:26:00 1827 Active 13 TRUE 47.37343 -122.1907 198823.5 825.361 0
2008-11-22 21:26:30 1897 Active 13 TRUE 47.37364 -122.1907 198823.5 825.361 0
2008-11-22 21:27:00 1841 Active 13 TRUE 47.37385 -122.1906 198823.5 825.361 0
2008-11-22 21:27:30 1562 Active 13 TRUE 47.37386 -122.1903 198823.5 825.361 0
2008-11-22 21:28:00 1544 Active 13 TRUE 47.37382 -122.1900 198823.5 825.361 0
2008-11-22 21:28:30 1758 Active 13 TRUE 47.37384 -122.1898 198823.5 825.361 0
2008-11-22 21:29:00 1783 Active 13 TRUE 47.37395 -122.1896 198823.5 825.361 0
2008-11-22 21:29:30 1853 Active 13 TRUE 47.37401 -122.1895 198823.5 825.361 0
2008-11-22 21:30:00 1413 Active 13 TRUE 47.37425 -122.1895 198823.5 825.361 0
2008-11-22 21:30:30 1027 Active 13 TRUE 47.37436 -122.1894 198823.5 825.361 0
2008-11-22 21:31:00 9 Low active 13 TRUE 47.37446 -122.1894 198823.5 825.361 0
2008-11-22 21:31:30 852 Active 13 NA NA NA 198823.5 825.361 0
2008-11-22 21:32:00 956 Active 13 NA NA NA 198823.5 825.361 0
2008-11-22 21:32:30 25 Low active 13 NA NA NA 198823.5 825.361 0
2008-11-22 21:33:00 425 Low active 13 NA NA NA 198823.5 825.361 0
2008-11-22 21:33:30 137 Low active 13 NA NA NA 198823.5 825.361 0
2008-11-22 21:34:00 570 Active 13 NA NA NA 198823.5 825.361 0
2008-11-22 21:34:30 335 Low active 13 TRUE 47.37442 -122.1897 198823.5 825.361 0
2008-11-22 21:35:00 93 Low active 13 NA NA NA 198823.5 825.361 0
2008-11-22 21:35:30 54 Low active 13 TRUE 47.37439 -122.1895 198823.5 825.361 0

ID 10902186: This is the same scenario as id 11516771 where we start on an active epoch and then hit 4 inactive epochs then have a string of activity, which prompts us to wait to start the bout until a few minutes after phil, at which point we do enter into a bout.

id <- 10902186
phil_start_time <- ymd_hms("2008-09-09 07:14:00")
phil_end_time <- ymd_hms("2008-09-09 07:33:00")
w_start_time <- ymd_hms("2008-09-09 07:17:00")
w_end_time <- ymd_hms("2008-09-09 07:35:30")
phil_bout_duration <- 19.5

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

kable(table %>% filter(!is.na(bout_label)))
epoch_time Axis1_epochSum Activity bout_label gps_inlier LATITUDE LONGITUDE Point_circle_area Point_radius incomplete_GPS
2008-09-09 07:17:00 1830 Active 33 FALSE 47.36484 -122.1975 111649.8 618.4992 0
2008-09-09 07:17:30 2340 Active 33 FALSE 47.36516 -122.1973 111649.8 618.4992 0
2008-09-09 07:18:00 2385 Active 33 TRUE 47.36537 -122.1976 111649.8 618.4992 0
2008-09-09 07:18:30 2337 Active 33 TRUE 47.36556 -122.1977 111649.8 618.4992 0
2008-09-09 07:19:00 1924 Active 33 TRUE 47.36572 -122.1979 111649.8 618.4992 0
2008-09-09 07:19:30 2254 Active 33 TRUE 47.36595 -122.1981 111649.8 618.4992 0
2008-09-09 07:20:00 2232 Active 33 NA NA NA 111649.8 618.4992 0
2008-09-09 07:20:30 2371 Active 33 TRUE 47.36622 -122.1985 111649.8 618.4992 0
2008-09-09 07:21:00 2328 Active 33 TRUE 47.36644 -122.1987 111649.8 618.4992 0
2008-09-09 07:21:30 2242 Active 33 TRUE 47.36659 -122.1989 111649.8 618.4992 0
2008-09-09 07:22:00 2262 Active 33 TRUE 47.36662 -122.1986 111649.8 618.4992 0
2008-09-09 07:22:30 2228 Active 33 TRUE 47.36678 -122.1983 111649.8 618.4992 0
2008-09-09 07:23:00 2198 Active 33 TRUE 47.36700 -122.1982 111649.8 618.4992 0
2008-09-09 07:23:30 2175 Active 33 NA NA NA 111649.8 618.4992 0
2008-09-09 07:24:00 2161 Active 33 TRUE 47.36741 -122.1979 111649.8 618.4992 0
2008-09-09 07:24:30 2005 Active 33 TRUE 47.36757 -122.1979 111649.8 618.4992 0
2008-09-09 07:25:00 2224 Active 33 TRUE 47.36778 -122.1979 111649.8 618.4992 0
2008-09-09 07:25:30 2068 Active 33 NA NA NA 111649.8 618.4992 0
2008-09-09 07:26:00 2348 Active 33 TRUE 47.36822 -122.1975 111649.8 618.4992 0
2008-09-09 07:26:30 925 Active 33 TRUE 47.36807 -122.1973 111649.8 618.4992 0
2008-09-09 07:27:00 595 Active 33 TRUE 47.36811 -122.1973 111649.8 618.4992 0
2008-09-09 07:27:30 900 Active 33 TRUE 47.36813 -122.1973 111649.8 618.4992 0
2008-09-09 07:28:00 2317 Active 33 TRUE 47.36828 -122.1970 111649.8 618.4992 0
2008-09-09 07:28:30 2395 Active 33 TRUE 47.36841 -122.1966 111649.8 618.4992 0
2008-09-09 07:29:00 2227 Active 33 TRUE 47.36847 -122.1964 111649.8 618.4992 0
2008-09-09 07:29:30 2374 Active 33 TRUE 47.36832 -122.1962 111649.8 618.4992 0
2008-09-09 07:30:00 2328 Active 33 TRUE 47.36869 -122.1960 111649.8 618.4992 0
2008-09-09 07:30:30 2308 Active 33 TRUE 47.36899 -122.1960 111649.8 618.4992 0
2008-09-09 07:31:00 2063 Active 33 TRUE 47.36912 -122.1960 111649.8 618.4992 0
2008-09-09 07:31:30 10 Low active 33 TRUE 47.36915 -122.1960 111649.8 618.4992 0
2008-09-09 07:32:00 1697 Active 33 NA NA NA 111649.8 618.4992 0
2008-09-09 07:32:30 0 Non_active 33 NA NA NA 111649.8 618.4992 0
2008-09-09 07:33:00 68 Low active 33 NA NA NA 111649.8 618.4992 0
2008-09-09 07:33:30 830 Active 33 NA NA NA 111649.8 618.4992 0
2008-09-09 07:34:00 0 Non_active 33 NA NA NA 111649.8 618.4992 0
2008-09-09 07:34:30 51 Low active 33 NA NA NA 111649.8 618.4992 0
2008-09-09 07:35:00 30 Low active 33 NA NA NA 111649.8 618.4992 0

ID 10704259: We start a bout at 14:22:00 on an active epoch. We end it at 14:33:30 when there are 4+ periods of inactivity.Phil ends at the same point for the same reason, presumably. Phil starts his bout on an active epoch at 14:25 presumably because he had been trying to start bouts before that and hitting his threshold of cumulative low/inactivity. This difference can be attributed to a difference in our implementation of cumulative vs consecutive thresholds for ending a bout and thus for where we begin bouts based on where other bouts end

id <- 10704259
phil_start_time <- ymd_hms("2008-09-10 14:25:00")
phil_end_time <- ymd_hms("2008-09-10 14:33:00")
w_start_time <- ymd_hms("2008-09-10 14:22:00")
w_end_time <- ymd_hms("2008-09-10 14:33:30")
phil_bout_duration <- 9

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

kable(table %>% filter(!is.na(bout_label)))
epoch_time Axis1_epochSum Activity bout_label gps_inlier LATITUDE LONGITUDE Point_circle_area Point_radius incomplete_GPS
2008-09-10 14:22:30 112 Low active 12 NA NA NA 13898.11 218.2167 0
2008-09-10 14:23:00 848 Active 12 NA NA NA 13898.11 218.2167 0
2008-09-10 14:23:30 125 Low active 12 TRUE 47.36885 -122.2087 13898.11 218.2167 0
2008-09-10 14:24:00 376 Low active 12 FALSE 47.36925 -122.2085 13898.11 218.2167 0
2008-09-10 14:24:30 153 Low active 12 NA NA NA 13898.11 218.2167 0
2008-09-10 14:25:00 1452 Active 12 TRUE 47.36898 -122.2096 13898.11 218.2167 0
2008-09-10 14:25:30 171 Low active 12 TRUE 47.36896 -122.2097 13898.11 218.2167 0
2008-09-10 14:26:00 852 Active 12 TRUE 47.36905 -122.2101 13898.11 218.2167 0
2008-09-10 14:26:30 2810 Active 12 TRUE 47.36912 -122.2100 13898.11 218.2167 0
2008-09-10 14:27:00 1822 Active 12 TRUE 47.36918 -122.2097 13898.11 218.2167 0
2008-09-10 14:27:30 1721 Active 12 TRUE 47.36937 -122.2094 13898.11 218.2167 0
2008-09-10 14:28:00 1391 Active 12 TRUE 47.36946 -122.2093 13898.11 218.2167 0
2008-09-10 14:28:30 1773 Active 12 TRUE 47.36959 -122.2094 13898.11 218.2167 0
2008-09-10 14:29:00 0 Non_active 12 TRUE 47.36944 -122.2095 13898.11 218.2167 0
2008-09-10 14:29:30 1496 Active 12 TRUE 47.36954 -122.2095 13898.11 218.2167 0
2008-09-10 14:30:00 2718 Active 12 TRUE 47.36956 -122.2093 13898.11 218.2167 0
2008-09-10 14:30:30 2217 Active 12 TRUE 47.36957 -122.2094 13898.11 218.2167 0
2008-09-10 14:31:00 2177 Active 12 TRUE 47.36957 -122.2094 13898.11 218.2167 0
2008-09-10 14:31:30 665 Active 12 TRUE 47.36945 -122.2095 13898.11 218.2167 0
2008-09-10 14:32:00 3066 Active 12 TRUE 47.36928 -122.2095 13898.11 218.2167 0
2008-09-10 14:32:30 3285 Active 12 TRUE 47.36911 -122.2099 13898.11 218.2167 0
2008-09-10 14:33:00 3233 Active 12 TRUE 47.36889 -122.2100 13898.11 218.2167 0

ID 14427353: This is the same scenario as above with different starts/stops due to differences in cumulative/consecutive inactivity to end a bout. we are already in a bout when phil starts this one!

id <- 14427353
phil_start_time <- ymd_hms("2009-05-29 13:55:00")
phil_end_time <- ymd_hms("2009-05-29 14:06:00")
w_start_time <- ymd_hms("2009-05-29 13:49:00")
w_end_time <- ymd_hms("2009-05-29 14:06:00")
phil_bout_duration <- 11

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

kable(table %>% filter(!is.na(bout_label)))
epoch_time Axis1_epochSum Activity bout_label gps_inlier LATITUDE LONGITUDE Point_circle_area Point_radius incomplete_GPS
2009-05-29 13:49:30 709 Active 4 TRUE 47.36675 -122.1933 108181.1 608.8156 0
2009-05-29 13:50:00 439 Low active 4 TRUE 47.36691 -122.1934 108181.1 608.8156 0
2009-05-29 13:50:30 595 Active 4 TRUE 47.36700 -122.1935 108181.1 608.8156 0
2009-05-29 13:51:00 433 Low active 4 TRUE 47.36714 -122.1935 108181.1 608.8156 0
2009-05-29 13:51:30 583 Active 4 TRUE 47.36726 -122.1935 108181.1 608.8156 0
2009-05-29 13:52:00 604 Active 4 TRUE 47.36741 -122.1934 108181.1 608.8156 0
2009-05-29 13:52:30 444 Low active 4 TRUE 47.36752 -122.1933 108181.1 608.8156 0
2009-05-29 13:53:00 302 Low active 4 TRUE 47.36756 -122.1933 108181.1 608.8156 0
2009-05-29 13:53:30 550 Active 4 TRUE 47.36766 -122.1932 108181.1 608.8156 0
2009-05-29 13:54:00 494 Low active 4 TRUE 47.36777 -122.1933 108181.1 608.8156 0
2009-05-29 13:54:30 453 Low active 4 TRUE 47.36790 -122.1933 108181.1 608.8156 0
2009-05-29 13:55:00 413 Low active 4 TRUE 47.36800 -122.1933 108181.1 608.8156 0
2009-05-29 13:55:30 569 Active 4 TRUE 47.36813 -122.1933 108181.1 608.8156 0
2009-05-29 13:56:00 449 Low active 4 TRUE 47.36827 -122.1933 108181.1 608.8156 0
2009-05-29 13:56:30 146 Low active 4 TRUE 47.36839 -122.1933 108181.1 608.8156 0
2009-05-29 13:57:00 317 Low active 4 TRUE 47.36840 -122.1933 108181.1 608.8156 0
2009-05-29 13:57:30 755 Active 4 TRUE 47.36855 -122.1933 108181.1 608.8156 0
2009-05-29 13:58:00 636 Active 4 TRUE 47.36870 -122.1933 108181.1 608.8156 0
2009-05-29 13:58:30 567 Active 4 TRUE 47.36882 -122.1933 108181.1 608.8156 0
2009-05-29 13:59:00 721 Active 4 TRUE 47.36897 -122.1933 108181.1 608.8156 0
2009-05-29 13:59:30 451 Low active 4 TRUE 47.36910 -122.1933 108181.1 608.8156 0
2009-05-29 14:00:00 722 Active 4 TRUE 47.36925 -122.1933 108181.1 608.8156 0
2009-05-29 14:00:30 688 Active 4 TRUE 47.36938 -122.1934 108181.1 608.8156 0
2009-05-29 14:01:00 743 Active 4 TRUE 47.36952 -122.1934 108181.1 608.8156 0
2009-05-29 14:01:30 706 Active 4 TRUE 47.36962 -122.1933 108181.1 608.8156 0
2009-05-29 14:02:00 652 Active 4 TRUE 47.36978 -122.1933 108181.1 608.8156 0
2009-05-29 14:02:30 634 Active 4 TRUE 47.36996 -122.1933 108181.1 608.8156 0
2009-05-29 14:03:00 648 Active 4 TRUE 47.37010 -122.1933 108181.1 608.8156 0
2009-05-29 14:03:30 648 Active 4 TRUE 47.37027 -122.1933 108181.1 608.8156 0
2009-05-29 14:04:00 344 Low active 4 TRUE 47.37039 -122.1933 108181.1 608.8156 0
2009-05-29 14:04:30 421 Low active 4 TRUE 47.37048 -122.1934 108181.1 608.8156 0
2009-05-29 14:05:00 474 Low active 4 TRUE 47.37067 -122.1933 108181.1 608.8156 0
2009-05-29 14:05:30 575 Active 4 TRUE 47.37080 -122.1933 108181.1 608.8156 0

ID 10300768: Phil shouldn’t have called this a bout because he says a bout must be at least 7 min… in any case, i dont know why this one is on the csv becuase we do start a bout at the same time as phil and we also end at the same time. perhaps this is something that i fixed at some point, but there is no issue here.

id <- 10300768
phil_start_time <- ymd_hms("2008-08-20 21:15:00")
phil_end_time <- ymd_hms("2008-08-20 21:20:00")
w_start_time <- ymd_hms("2008-08-20 21:15:00")
w_end_time <- ymd_hms("2008-08-20 21:20:00")
phil_bout_duration <- 6

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

kable(table %>% filter(!is.na(bout_label)))
epoch_time Axis1_epochSum Activity bout_label gps_inlier LATITUDE LONGITUDE Point_circle_area Point_radius incomplete_GPS
2008-08-20 21:15:30 1790 Active 55 NA NA NA 4422.625 123.0978 0
2008-08-20 21:16:00 467 Low active 55 NA NA NA 4422.625 123.0978 0
2008-08-20 21:16:30 586 Active 55 NA NA NA 4422.625 123.0978 0
2008-08-20 21:17:00 537 Active 55 TRUE 47.36870 -122.1902 4422.625 123.0978 0
2008-08-20 21:17:30 683 Active 55 TRUE 47.36854 -122.1901 4422.625 123.0978 0
2008-08-20 21:18:00 662 Active 55 NA NA NA 4422.625 123.0978 0
2008-08-20 21:18:30 906 Active 55 TRUE 47.36855 -122.1899 4422.625 123.0978 0
2008-08-20 21:19:00 981 Active 55 TRUE 47.36845 -122.1897 4422.625 123.0978 0
2008-08-20 21:19:30 1042 Active 55 NA NA NA 4422.625 123.0978 0

Section 2: GPS Dwell bout radii investigation

PA bouts occurring within a single location were considered as “dwells,” which were considered non-walking by definition. Identifying a dwell bout was accomplished by (1) calculating the sum of distances from each point to all other points within the bout; (2) selecting points having sum distance below the 95th percentile of the sum distances of all points in the bout; (3) generating a minimum bounding circle fully containing the selected points; (4) finally obtaining the circle’s radius. Bouts with radii <= 66 ft were considered as dwell bouts. Because some non-dwell bouts with few GPS observations were likely to have radii <= 66 ft, dwell bouts were defined as having >=10 GPS points.

Three types of issues to look into, will look at 2 of each: 1. Phil identifies a dwell bout and Weipeng identifies nothing 2. Phil identifies a dwell bout and Weipeng identifies a walk bout 3. Phil identifies a dwell bout and Weipeng identifies a nonwalk2_gps_speed bout

1. Phil identifies a dwell bout and Weipeng identifies nothing

ID 11613715: This issue is similar to the issues described in the previous section of this document. Phil starts a bout at 15:03 with a single active period followed by 4 low active periods, which end our bout and make us restart the bout at 15:06, at which point we begin a bout that goes until 16:06 as well. I could see Phil starting this bout, reaching the 4 epochs of low active, and continuing because he ends when he hits the 5th (he allows for 4 and then stops at the next one) - however, at 15:11 there is another low active epoch, which should have theoretically ended his bout because that is the 5th low active epoch in his bout (assuming his accelerometry processing is correct). The only other explanation which is mentioned elsewhere in this document is that it is not simply a threshold of 4 low/inactive epochs, but rather some ratio of low/inactive epochs to active epochs. This does bring up a question I have, though, which is: Should we be allowing for 5 low active/inactive epochs and ending on the active epoch before the 5th? We can do this counting consecutively in the same way phil does it counting cumulatively. Right now, when we hit 4 low active epochs, that ends our bout. If someone were to be active on the 5th epoch, should we allow the bout to continue?

id <- 11613715
phil_start_time <- ymd_hms("2008-11-15 15:03:00")
w_start_time <- ymd_hms("2008-11-15 15:06:00")
phil_end_time <- ymd_hms("2008-11-15 16:06:00")
w_end_time <- ymd_hms("2008-11-15 16:06:30")
phil_bout_duration <- 64

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

ID 11516901: This seems like partially a merge issue on our end - we do start a bout at 22:10 as well, but we end the bout at 22:16. This is because at 22:17 we commence 4 epochs in a row of low activity. Phil ends at 22:22 on a low active epoch that theoretically puts him over his cumulative threshold of 4 epochs within a bout and ending when we hit a 5th of low/inactivity. However, there are 3 low active epochs at 22:11:00, 22:11:30, and 22:12:00. So, if I understand his algorithm correctly, he should have ended when we did because at 22:17:00 and 22:17:30 the fourth/fifth low active epoch occurs.

id <- 11516901
phil_start_time <- ymd_hms("2008-11-07 22:10:00")
w_start_time <- ymd_hms("2008-11-07 22:10:30")
phil_end_time <- ymd_hms("2008-11-07 22:22:00")
w_end_time <- ymd_hms("2008-11-07 22:16:30")
phil_bout_duration <- 12

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

kable(table %>% filter(!is.na(bout_label)))
epoch_time Axis1_epochSum Activity bout_label gps_inlier LATITUDE LONGITUDE Point_circle_area Point_radius incomplete_GPS
2008-11-07 22:10:30 551 Active 5 TRUE 47.35669 -122.1835 31.04186 10.31297 0
2008-11-07 22:11:00 310 Low active 5 NA NA NA 31.04186 10.31297 0
2008-11-07 22:11:30 167 Low active 5 TRUE 47.35667 -122.1835 31.04186 10.31297 0
2008-11-07 22:12:00 244 Low active 5 FALSE 47.35656 -122.1835 31.04186 10.31297 0
2008-11-07 22:12:30 744 Active 5 TRUE 47.35666 -122.1835 31.04186 10.31297 0
2008-11-07 22:13:00 2135 Active 5 TRUE 47.35664 -122.1835 31.04186 10.31297 0
2008-11-07 22:13:30 1165 Active 5 TRUE 47.35667 -122.1835 31.04186 10.31297 0
2008-11-07 22:14:00 1166 Active 5 TRUE 47.35666 -122.1835 31.04186 10.31297 0
2008-11-07 22:14:30 1676 Active 5 TRUE 47.35667 -122.1835 31.04186 10.31297 0
2008-11-07 22:15:00 826 Active 5 NA NA NA 31.04186 10.31297 0
2008-11-07 22:15:30 1047 Active 5 NA NA NA 31.04186 10.31297 0
2008-11-07 22:16:00 615 Active 5 NA NA NA 31.04186 10.31297 0
2008-11-07 22:16:30 1113 Active 5 NA NA NA 31.04186 10.31297 0

2. Phil identifies a dwell bout and Weipeng identifies a walk bout

ID 10101312: I think that this is a bug in our GPS code and in Phil’s. We have 3 rows of long/lat gps data and the threshold per phil’s paper and our refvalues is at least 5 rows of gps data. So, this should not be a dwell bout. that said, it should also not be a walk bout - we label walk1_GPS as 1 but sufficient_GPS_coverage is FALSE. i do not think this is possible. I have edited line 178 of process_one_subject to reflect this change and make walk1_GPS 1 when all existing conditions are true AND we have sufficient GPS coverage. Steve, I believe this is correct but please let me know if i am incorrect here.

id <- 10101312
phil_start_time <- ymd_hms("2008-07-12 21:31:00")
w_start_time <- ymd_hms("2008-07-12 21:31:00")
phil_end_time <- ymd_hms("2008-07-12 21:38:00")
w_end_time <- ymd_hms("2008-07-12 21:39:00")
phil_bout_duration <- 7

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

kable(table %>% filter(!is.na(bout_label)))
epoch_time Axis1_epochSum Activity bout_label gps_inlier LATITUDE LONGITUDE Point_circle_area Point_radius incomplete_GPS
2008-07-12 21:31:30 1529 Active 8 NA NA NA NA NA 1
2008-07-12 21:32:00 765 Active 8 NA 48.43961 -122.3006 NA NA 1
2008-07-12 21:32:30 921 Active 8 NA NA NA NA NA 1
2008-07-12 21:33:00 1119 Active 8 NA 48.43952 -122.3005 NA NA 1
2008-07-12 21:33:30 1315 Active 8 NA NA NA NA NA 1
2008-07-12 21:34:00 1239 Active 8 NA NA NA NA NA 1
2008-07-12 21:34:30 1706 Active 8 NA NA NA NA NA 1
2008-07-12 21:35:00 1533 Active 8 NA NA NA NA NA 1
2008-07-12 21:35:30 2790 Active 8 NA 48.43962 -122.3006 NA NA 1
2008-07-12 21:36:00 153 Low active 8 NA NA NA NA NA 1
2008-07-12 21:36:30 22 Low active 8 NA NA NA NA NA 1
2008-07-12 21:37:00 4 Low active 8 NA NA NA NA NA 1
2008-07-12 21:37:30 508 Active 8 NA NA NA NA NA 1
2008-07-12 21:38:00 1885 Active 8 NA NA NA NA NA 1
2008-07-12 21:38:30 0 Non_active 8 NA NA NA NA NA 1

ID 10102248: We are calling this a walkbout and phil is calling it a dwell bout. This is a similar issue to #1 - i dont think we have the correct logic in here to differentiate sufficient gps coverage, insufficient gps coverage.

It looks like the logic right now is as follows: 1. If there are not enough rows of lat/long data (where the threshold is 5 observations), then a bout cannot be a dwell bout and is labeled as having incomplete GPS coverage. 2. Dwell bouts are then compiled if they have sufficient gps coverage, and the remaining bouts are compiled into nonwalk_acc, nonwalk_gps, and walk_gps bouts based on (a) having complete days (complete days require that the net activity per day exceed the minimum wearing times), (b) is not a dwell bout, and (c) meets the speed requirements. There is nothing about GPS coverage in the categorization of the non-dwell bouts.

I believe that this is an oversight, but want to clarify the various forms of GPS coverage metrics we have. For a given bout, we have: 1. Insufficient_GPS_coverage = 1 if we do not have enough rows of lat/long data a. (nrow(Point_ind)<refvalues_s$min_gps_consec_obs, refvalues_s$min_gps_consec_obs = 5") 2. sufficient_GPS_records = TRUE if the number of valid GPS records for that bout is greater than our minimum GPS observation within bout requirement, which is 5 a. (n_valid_GPS_records>refvalues$min_gps_obs_within_bout, refvalues$min_gps_obs_within_bout = 5") 3. sufficient_GPS_coverage = TRUE if the GPS coverage ratio that we compute as the valid GPS records (a valid record is where speed, lat, long are all not NA) during that bout over the number of records included in that bout. a. (GPS_coverage_ratio>refvalues$min_gps_coverage_ratio, refvalues$min_gps_coverage_ratio = 0.2")

However, these values are never used to distinguish whether a bout is a walk bout or not. The only metric used is insufficient_gps_coverage to assess whether an identified dwell bout can be considered a dwell bout.

id <- 10102248
phil_start_time <- ymd_hms("2008-07-29 13:22:00")
w_start_time <- ymd_hms("2008-07-29 13:22:00")
phil_end_time <- ymd_hms("2008-07-29 13:29:00")
w_end_time <- ymd_hms("2008-07-29 13:29:00")
phil_bout_duration <- 8

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

kable(table %>% filter(!is.na(bout_label)))
epoch_time Axis1_epochSum Activity bout_label gps_inlier LATITUDE LONGITUDE Point_circle_area Point_radius incomplete_GPS
2008-07-29 13:22:30 4 Low active 44 NA NA NA NA NA 1
2008-07-29 13:23:00 660 Active 44 NA 47.36299 -122.1997 NA NA 1
2008-07-29 13:23:30 1035 Active 44 NA 47.36297 -122.2000 NA NA 1
2008-07-29 13:24:00 558 Active 44 NA 47.36288 -122.2002 NA NA 1
2008-07-29 13:24:30 1209 Active 44 NA NA NA NA NA 1
2008-07-29 13:25:00 1060 Active 44 NA NA NA NA NA 1
2008-07-29 13:25:30 562 Active 44 NA NA NA NA NA 1
2008-07-29 13:26:00 870 Active 44 NA 47.36297 -122.2000 NA NA 1
2008-07-29 13:26:30 1116 Active 44 NA NA NA NA NA 1
2008-07-29 13:27:00 589 Active 44 NA NA NA NA NA 1
2008-07-29 13:27:30 2 Low active 44 NA NA NA NA NA 1
2008-07-29 13:28:00 292 Low active 44 NA NA NA NA NA 1
2008-07-29 13:28:30 368 Low active 44 NA NA NA NA NA 1

3. Phil identifies a dwell bout and Weipeng identifies a nonwalk2_gps_speed bout

ID 10800490: Question: where did we get the label nonwalk2_gps_speed from weipeng’s output? I cannot find that label in the actual code. This bout is identified by both weipeng and phil as a dwell bout - i am not sure why it does not show up in the spreadsheet that we generated! But, it ALSO shows up at a nonwalk bout because the speeds are too slow to be considered walking (the speed range is 0.1-1 and the speed range we require is 2-5.). As such, NonWalk2_GPS is 1 and dwell_bout is 1 as well. So, I think that this is sort of an edge case and is not an error in anyone’s code, but is likely due to some filtering or collapse issues. I’d be curious if Phil also marks it as both a dwell_bout and a nonwalk bout due to speed. This brings up a few questions: 1. It seems like a lot of dwell bouts would have speeds below the speed threshold for a bout. So, is it wrong that this is marked as both a dwell bout and a nonwalk bout due to speed? Should we mark dwell bout as 0 once non walk due to speed is marked as 1? TODO: do we ever remove the dwell bout label?

id <- 10800490
phil_start_time <- ymd_hms("2008-09-14 12:34:00")
w_start_time <- ymd_hms("2008-09-14 12:34:00")
phil_end_time <- ymd_hms("2008-09-14 12:44:00")
w_end_time <- ymd_hms("2008-09-14 12:44:00")
phil_bout_duration <- 10.5

min_gps_walking_speed_km_h <- 2
max_gps_walking_speed_km_h <- 6

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

kable(table %>% filter(!is.na(bout_label)))
epoch_time Axis1_epochSum Activity bout_label gps_inlier LATITUDE LONGITUDE Point_circle_area Point_radius incomplete_GPS
2008-09-14 12:34:30 799 Active 25 TRUE 47.37401 -122.1870 30.80553 10.27364 0
2008-09-14 12:35:00 648 Active 25 FALSE 47.37404 -122.1869 30.80553 10.27364 0
2008-09-14 12:35:30 146 Low active 25 FALSE 47.37403 -122.1870 30.80553 10.27364 0
2008-09-14 12:36:00 32 Low active 25 TRUE 47.37401 -122.1870 30.80553 10.27364 0
2008-09-14 12:36:30 769 Active 25 TRUE 47.37401 -122.1870 30.80553 10.27364 0
2008-09-14 12:37:00 747 Active 25 TRUE 47.37399 -122.1870 30.80553 10.27364 0
2008-09-14 12:37:30 996 Active 25 TRUE 47.37398 -122.1870 30.80553 10.27364 0
2008-09-14 12:38:00 1267 Active 25 TRUE 47.37399 -122.1870 30.80553 10.27364 0
2008-09-14 12:38:30 1005 Active 25 TRUE 47.37400 -122.1870 30.80553 10.27364 0
2008-09-14 12:39:00 837 Active 25 TRUE 47.37401 -122.1870 30.80553 10.27364 0
2008-09-14 12:39:30 499 Low active 25 TRUE 47.37401 -122.1870 30.80553 10.27364 0
2008-09-14 12:40:00 1476 Active 25 TRUE 47.37402 -122.1870 30.80553 10.27364 0
2008-09-14 12:40:30 1220 Active 25 TRUE 47.37402 -122.1870 30.80553 10.27364 0
2008-09-14 12:41:00 1021 Active 25 TRUE 47.37402 -122.1870 30.80553 10.27364 0
2008-09-14 12:41:30 624 Active 25 TRUE 47.37402 -122.1870 30.80553 10.27364 0
2008-09-14 12:42:00 422 Low active 25 TRUE 47.37402 -122.1870 30.80553 10.27364 0
2008-09-14 12:42:30 671 Active 25 TRUE 47.37402 -122.1870 30.80553 10.27364 0
2008-09-14 12:43:00 376 Low active 25 TRUE 47.37402 -122.1870 30.80553 10.27364 0
2008-09-14 12:43:30 454 Low active 25 TRUE 47.37401 -122.1869 30.80553 10.27364 0

ID 10705609: This is the exact same situation as ID 10800490 above, but also ends at a different time due to the consecutive vs cumulative counting of low/inactive epochs to end a bout.

id <- 10705609
phil_start_time <- ymd_hms("2008-09-29 12:42:00")
w_start_time <- ymd_hms("2008-09-29 12:42:00")
phil_end_time <- ymd_hms("2008-09-29 12:54:00")
w_end_time <- ymd_hms("2008-09-29 12:56:00")
phil_bout_duration <- 13

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

kable(table %>% filter(!is.na(bout_label)))
epoch_time Axis1_epochSum Activity bout_label gps_inlier LATITUDE LONGITUDE Point_circle_area Point_radius incomplete_GPS
2008-09-29 12:42:30 542 Active 3 TRUE 47.36928 -122.2081 230.2006 28.08428 0
2008-09-29 12:43:00 934 Active 3 TRUE 47.36928 -122.2081 230.2006 28.08428 0
2008-09-29 12:43:30 214 Low active 3 TRUE 47.36932 -122.2081 230.2006 28.08428 0
2008-09-29 12:44:00 758 Active 3 TRUE 47.36933 -122.2081 230.2006 28.08428 0
2008-09-29 12:44:30 399 Low active 3 TRUE 47.36933 -122.2081 230.2006 28.08428 0
2008-09-29 12:45:00 600 Active 3 TRUE 47.36933 -122.2081 230.2006 28.08428 0
2008-09-29 12:45:30 568 Active 3 TRUE 47.36932 -122.2081 230.2006 28.08428 0
2008-09-29 12:46:00 514 Active 3 TRUE 47.36932 -122.2081 230.2006 28.08428 0
2008-09-29 12:46:30 278 Low active 3 TRUE 47.36932 -122.2081 230.2006 28.08428 0
2008-09-29 12:47:00 549 Active 3 TRUE 47.36929 -122.2082 230.2006 28.08428 0
2008-09-29 12:47:30 447 Low active 3 TRUE 47.36933 -122.2082 230.2006 28.08428 0
2008-09-29 12:48:00 572 Active 3 TRUE 47.36933 -122.2082 230.2006 28.08428 0
2008-09-29 12:48:30 551 Active 3 TRUE 47.36933 -122.2082 230.2006 28.08428 0
2008-09-29 12:49:00 581 Active 3 TRUE 47.36933 -122.2082 230.2006 28.08428 0
2008-09-29 12:49:30 288 Low active 3 TRUE 47.36932 -122.2082 230.2006 28.08428 0
2008-09-29 12:50:00 38 Low active 3 TRUE 47.36934 -122.2081 230.2006 28.08428 0
2008-09-29 12:50:30 682 Active 3 TRUE 47.36934 -122.2082 230.2006 28.08428 0
2008-09-29 12:51:00 970 Active 3 TRUE 47.36934 -122.2081 230.2006 28.08428 0
2008-09-29 12:51:30 277 Low active 3 TRUE 47.36935 -122.2082 230.2006 28.08428 0
2008-09-29 12:52:00 638 Active 3 TRUE 47.36927 -122.2082 230.2006 28.08428 0
2008-09-29 12:52:30 629 Active 3 TRUE 47.36923 -122.2082 230.2006 28.08428 0
2008-09-29 12:53:00 551 Active 3 TRUE 47.36919 -122.2082 230.2006 28.08428 0
2008-09-29 12:53:30 834 Active 3 TRUE 47.36916 -122.2082 230.2006 28.08428 0
2008-09-29 12:54:00 748 Active 3 FALSE 47.36913 -122.2082 230.2006 28.08428 0
2008-09-29 12:54:30 857 Active 3 FALSE 47.36912 -122.2082 230.2006 28.08428 0
2008-09-29 12:55:00 307 Low active 3 TRUE 47.36922 -122.2081 230.2006 28.08428 0
2008-09-29 12:55:30 14 Low active 3 TRUE 47.36922 -122.2081 230.2006 28.08428 0

Code Appendix

knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(lubridate)
library(knitr)
library(ggforce)
library(lwgeom)
library(sf)
library(geosphere)
library(measurements)
library(patchwork)

low_active_thresh <- 500
gps_thresh <- 66
# bout_plot(id, gps_thresh, low_active_thresh, table)

# Plotting function
source("~/repos/rwalkbout/R/bout_plot.R")
id <- 10100725
phil_start_time <- ymd_hms("2008-07-21 10:25:00")
phil_end_time <- ymd_hms("2008-07-21 10:46:00")
w_start_time <- ymd_hms("2008-07-21 10:21:00")
w_end_time <- ymd_hms("2008-07-21 10:52:30")
phil_bout_duration <- 21.5

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

id <- 14835176
phil_start_time <- ymd_hms("2009-07-08 08:57:00")
phil_end_time <- ymd_hms("2009-07-08 09:07:00")
w_start_time <- ymd_hms("2009-07-08 08:46:00")
w_end_time <- ymd_hms("2009-07-08 09:07:00")
phil_bout_duration <- 10

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)
kable(table %>% filter(!is.na(bout_label)))

id <- 14830788
phil_start_time <- ymd_hms("2009-07-02 11:07:00")
phil_end_time <- ymd_hms("2009-07-02 14:31:00")
w_start_time <- ymd_hms("2009-07-02 11:07:30")
w_end_time <- ymd_hms("2009-07-02 11:12:00")
phil_bout_duration <- 204

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

id <- 13322435
phil_start_time <- ymd_hms("2009-04-17 15:57:00")
phil_end_time <- ymd_hms("2009-04-17 17:15:00")
w_start_time <- ymd_hms("2009-04-17 15:45:30")
w_end_time <- ymd_hms("2009-04-17 15:59:30")
phil_bout_duration <- 78

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

id <- 10101700
phil_start_time <- ymd_hms("2008-09-14 09:01:00")
phil_end_time <- ymd_hms("2008-09-14 09:39:00")
w_start_time <- ymd_hms("2008-09-14 07:58:00")
w_end_time <- ymd_hms("2008-09-14 09:24:30")
phil_bout_duration <- 38.5

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)

id <- 11516771
phil_start_time <- ymd_hms("2008-11-22 21:13:00")
phil_end_time <- ymd_hms("2008-11-22 21:34:00")
w_start_time <- ymd_hms("2008-11-22 21:15:30")
w_end_time <- ymd_hms("2008-11-22 21:36:00")
phil_bout_duration <- 21.5

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)
kable(table %>% filter(!is.na(bout_label)))

id <- 10902186
phil_start_time <- ymd_hms("2008-09-09 07:14:00")
phil_end_time <- ymd_hms("2008-09-09 07:33:00")
w_start_time <- ymd_hms("2008-09-09 07:17:00")
w_end_time <- ymd_hms("2008-09-09 07:35:30")
phil_bout_duration <- 19.5

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)
kable(table %>% filter(!is.na(bout_label)))

id <- 10704259
phil_start_time <- ymd_hms("2008-09-10 14:25:00")
phil_end_time <- ymd_hms("2008-09-10 14:33:00")
w_start_time <- ymd_hms("2008-09-10 14:22:00")
w_end_time <- ymd_hms("2008-09-10 14:33:30")
phil_bout_duration <- 9

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)
kable(table %>% filter(!is.na(bout_label)))

id <- 14427353
phil_start_time <- ymd_hms("2009-05-29 13:55:00")
phil_end_time <- ymd_hms("2009-05-29 14:06:00")
w_start_time <- ymd_hms("2009-05-29 13:49:00")
w_end_time <- ymd_hms("2009-05-29 14:06:00")
phil_bout_duration <- 11

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)
kable(table %>% filter(!is.na(bout_label)))

id <- 10300768
phil_start_time <- ymd_hms("2008-08-20 21:15:00")
phil_end_time <- ymd_hms("2008-08-20 21:20:00")
w_start_time <- ymd_hms("2008-08-20 21:15:00")
w_end_time <- ymd_hms("2008-08-20 21:20:00")
phil_bout_duration <- 6

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)
kable(table %>% filter(!is.na(bout_label)))

id <- 11613715
phil_start_time <- ymd_hms("2008-11-15 15:03:00")
w_start_time <- ymd_hms("2008-11-15 15:06:00")
phil_end_time <- ymd_hms("2008-11-15 16:06:00")
w_end_time <- ymd_hms("2008-11-15 16:06:30")
phil_bout_duration <- 64

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)
id <- 11516901
phil_start_time <- ymd_hms("2008-11-07 22:10:00")
w_start_time <- ymd_hms("2008-11-07 22:10:30")
phil_end_time <- ymd_hms("2008-11-07 22:22:00")
w_end_time <- ymd_hms("2008-11-07 22:16:30")
phil_bout_duration <- 12

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)
kable(table %>% filter(!is.na(bout_label)))

id <- 10101312
phil_start_time <- ymd_hms("2008-07-12 21:31:00")
w_start_time <- ymd_hms("2008-07-12 21:31:00")
phil_end_time <- ymd_hms("2008-07-12 21:38:00")
w_end_time <- ymd_hms("2008-07-12 21:39:00")
phil_bout_duration <- 7

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)
kable(table %>% filter(!is.na(bout_label)))

id <- 10102248
phil_start_time <- ymd_hms("2008-07-29 13:22:00")
w_start_time <- ymd_hms("2008-07-29 13:22:00")
phil_end_time <- ymd_hms("2008-07-29 13:29:00")
w_end_time <- ymd_hms("2008-07-29 13:29:00")
phil_bout_duration <- 8

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)
kable(table %>% filter(!is.na(bout_label)))

id <- 10800490
phil_start_time <- ymd_hms("2008-09-14 12:34:00")
w_start_time <- ymd_hms("2008-09-14 12:34:00")
phil_end_time <- ymd_hms("2008-09-14 12:44:00")
w_end_time <- ymd_hms("2008-09-14 12:44:00")
phil_bout_duration <- 10.5

min_gps_walking_speed_km_h <- 2
max_gps_walking_speed_km_h <- 6

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)
kable(table %>% filter(!is.na(bout_label)))


id <- 10705609
phil_start_time <- ymd_hms("2008-09-29 12:42:00")
w_start_time <- ymd_hms("2008-09-29 12:42:00")
phil_end_time <- ymd_hms("2008-09-29 12:54:00")
w_end_time <- ymd_hms("2008-09-29 12:56:00")
phil_bout_duration <- 13

df <- read.csv(paste0("~/walkbout_csvs/", id, "_gps_acc.csv"))

table <- df %>%
  mutate(epoch_time = ymd_hms(epoch_time)) %>% 
  filter(epoch_time > min(phil_start_time, w_start_time)) %>% 
  filter(epoch_time < max(phil_end_time, w_end_time)) %>% 
  select("epoch_time", "Axis1_epochSum", "Activity", "bout_label", "gps_inlier", 
         "epoch_time", "LATITUDE", "LONGITUDE", "Point_circle_area", "Point_radius", "incomplete_GPS")
bout <- table %>% filter(!(is.na(bout_label)))
bout <- unique(bout$bout_label)
bout_plot(id, gps_thresh, low_active_thresh, table)
kable(table %>% filter(!is.na(bout_label)))